package com.SinaMicrobloggingApi.Core.Request;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.CoreProtocolPNames;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;

import com.SinaMicrobloggingApi.Core.OauthConstants;
import com.SinaMicrobloggingApi.Core.Response.IResponse;
import com.Util.HttpUtility;
import com.Util.StringBuilder2;

/**
 * @author Administrator
 * 
 */
public class StatusesUpdateRequest extends RequestBase {

	private static final String STATUES_UPDATE = "StatusesUpdate";
	private static final String STATUS = "status";
	private String status = "";

	public StatusesUpdateRequest(IResponse response, String userId,
			String password, String status) {
		super(response);
		// TODO Auto-generated constructor stub
		this.status = handingString(status);
		this.password = password;
		this.userId = userId;
	}

	@Override
	protected String getRequestName() {
		// TODO Auto-generated method stub
		return STATUES_UPDATE;
	}

	protected HttpMethodEnum getHttpMethod() {
		return HttpMethodEnum.POST;
	}

	protected String getRequestParamenters() {

		BasicNameValuePair oauth_token = new BasicNameValuePair(
				OauthConstants.OAUTH_TOKEN_KEY, getOauthToken());
		BasicNameValuePair oauth_status = new BasicNameValuePair(STATUS, status);
		BasicNameValuePair oauth_source = new BasicNameValuePair(
				RequestBase.SOURCE, super.getConsumerKey());
		oauthParamenterModels.add(oauth_token);
		oauthParamenterModels.add(oauth_status);
		oauthParamenterModels.add(oauth_source);
		return super.getRequestParamenters();
	}
}
